Multiple Dialogs

Hello,

I'm facing a unique challenge creating a script which generates reports. It pulls a string, and then detects based on that string what type of comparison needs to be done, and then runs a function which generates the report for that specific comparison style. The problem occurs when the computer can't detect which comparison style to use. I'm planning to have a dialog box pop up which prompts the user to manually select a style. If the user selects two report items which comparison styles are not found, it pulls up the dialog to allow the selection for the first one, but breaks the loop and won't pop up a second dialog to allow the user to do anything for the second. I was trying to create a while loop which would pop up the dialog multiple times with the information specific to each instance. 

 

For instance, when the user selects 2 modules (in a previous window) that cannot be identified, it will pop up dialog 1 asking for a selection for the first one (clicking accept then runs the comparison function), and then the dialog 2 asking for the selection for the other module.

 

void fnOther(DB) {
        sCurrentModName = sOtherModName[iOtherCurrent]
        sCurrentDesc = sOtherDesc[iOtherCurrent]
        sCurrentSVer = sOtherSVer[iOtherCurrent]
        sCurrentEVer = sOtherEVer[iOtherCurrent]        
        DB dbOther = create("Comparison Style Not Found", styleCentered|styleFixed)
        string sLabel = "You have selected Module: " sCurrentModName "\nwith description: " sCurrentDesc ""
        label(dbOther, sLabel)
        separator(dbOther)
        label(dbOther, "There is no programmed comparison style for this description.\n\nPlease select from the list of available comparison styles below, or click skip")
        string sStyles[] = {"Main_Body", "Test Variables", "Constants", "Shutdowns", "Faults", "FADEC CIC Logic"}
        dbeCompStyle = choice(dbOther, "Comparison Style: ", sStyles, 0)
        left(dbOther)
        label(dbOther, "Any additional comparison styles will need to be manually programmed")
        ok(dbOther, "Accept", fnAccept)
        close(dbOther, false, fnExit)
        iTemp++
        show dbOther
    }
}

the problem is, I've tried using a while loop, but the action of showing the dialog box breaks the while loop. Are there any suggestions to get around this? i tried a different method which checked to see if any other "not found modules" were identified with the intention of just running the fnOther function again, however the placement of all the functions in the script places the fnOther function underneath where it would need to be called.

 

I appreciate any help!!


fj91 - Sun Mar 06 21:06:43 EST 2016

Re: Multiple Dialogs
PekkaMakinen - Mon Mar 07 03:16:47 EST 2016

For "show" the DXL help mentions: "Displays the dialog box and suspends execution of the DXL program. Execution only continues in callbacks from the buttons on the dialog box. No code should appear after a show as it would never be executed."

But you could read through the "block" entry in DXL Help, as for this there is a mention: "Unlike show, DXL program execution is resumed after the call to block when the modal dialog box is released."

I have not gone through your code / problem but I think the block / release dialog box functions would work in a while loop.

Re: Multiple Dialogs
Mathias Mamsch - Mon Mar 07 03:26:39 EST 2016

You need to realize, that a dialog in DXL run with "show" should be a single DXL program. So I would suggest to you having the parent start comparison dialogs for each module using "eval_" ... This will make them independent from each other and might save you headache with global variables shared between both dialogs, etc. 

Having one DXL program launch different dialog boxes with "show" might not work well ... If you still want to try it you need to know how "show" works. As you can read in the DXL manual, show will STOP the DXL execution and enter the window loop ... That means after the first "show" inside the loop the program will not continue anymore. If you therefore want to have multiple dialogs shown by the same program, you need to realize all dialogs and only show the last one. Still when I remember correctly this will bring problems, since all but the last dialog might not work correctly, since show/block was never called on them. 

Therefore you should go with "eval_" ... regards, Mathias